-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
System modes inference #50
Conversation
@@ -35,6 +36,7 @@ class LaserResender : public rclcpp_lifecycle::LifecycleNode | |||
LaserResender() | |||
: rclcpp_lifecycle::LifecycleNode("laser_resender") | |||
{ | |||
declare_parameter("node_name"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the intention of this node_name
here? Could be a better id
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Following the Arne suggestions in micro-ROS/system_modes#45 (comment) I have defined a fake parameter.
Currently, there has to be a parameter, because otherwise the mode is invisible from the outside and can't be inferred in any way.
You may want to introduce a simple fake parameter, that is a bool for example or - to make it a bit easier to understand - a string parameter that holds the name of the mode. We stumbled upon this question before.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
mros_contingencies_sim/include/mros_contingencies_sim/battery_contingency_node.hpp
Show resolved
Hide resolved
cli = self.create_client(ChangeMode, '/'+node_name+'/change_mode') | ||
while not cli.wait_for_service(timeout_sec=1.0): | ||
print('service not available, waiting again...') | ||
req = ChangeMode.Request() | ||
req.node_name = node_name |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This causes an error with newer versions of system_modes
:
ros2 run metacontroller_pilot metacontroller
Traceback (most recent call last):
File "/home/parallels/pilot_urjc_ws/install/metacontroller_pilot/lib/metacontroller_pilot/metacontroller", line 11, in <module>
load_entry_point('metacontroller-pilot', 'console_scripts', 'metacontroller')()
File "/home/parallels/pilot_urjc_ws/build/metacontroller_pilot/metacontroller_pilot/metacontroller_sim.py", line 67, in main
node.change_mode("pilot", '__DEFAULT__')
File "/home/parallels/pilot_urjc_ws/build/metacontroller_pilot/metacontroller_pilot/metacontroller_sim.py", line 47, in change_mode
req.node_name = node_name
AttributeError: 'ChangeMode_Request' object has no attribute 'node_name'
req.node_name = node_name |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am using the feature/rules
branch, and this field is necessary. I have changed the dependencies.repos file to download this branch instead of master
I have added the changes to solve these issues in #51 |
System modes inference
Please, accept first my previous PR #48
This PR adds the rules to the pilot_modes to support the inference and adaptation of the system_modes:
I have tested adaptation of the system_modes in case of laser failure.
I have modified the dummy metacontroller to read the logs of the battery and change the mode to ENERGY_SAVING.
Future works